/*************************************************************************
        > File Name: 101_hz.c
        > Author: zhangxu
        > Mail: walrus1983@126.com
        > Created Time: 三  7/10 10:18:09 2024
 ************************************************************************/
// 位数求和，用字符串处理
#include <stdio.h>

int main() {
  char s[10];
  scanf("%s", s);
  int a = 0, b = 0, c = 0, d = 0;
  sscanf(s, "%1d%1d%1d%1d", &a, &b, &c, &d);
  printf("%d\n", a + b + c + d);
  return 0;
}